package wendyeq.iweb.blog.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import wendyeq.iweb.blog.dao.IVisitorDAO;
import wendyeq.iweb.blog.pojo.Comment;
import wendyeq.iweb.blog.pojo.Visitor;
import wendyeq.iweb.blog.service.IVisitorService;

@Service("visitorServiceImpl")
public class VisitorServiceImpl implements IVisitorService {
	private static final Logger logger = Logger.getLogger(VisitorServiceImpl.class);
	
	@Resource(name="visitorDAO")
	private IVisitorDAO visitorDAO;
	
	/*public Visitor insert(String ip, String os, String browser, String userAgent) {
		Visitor visitor = new Visitor(ip, os, browser);
		visitor.setUserAgent(userAgent);
		return this.visitorDAO.insert(visitor);
	}
	
	public Visitor insert(String ip, String os, String browser, String userAgent, Comment comment) {
		Visitor visitor = new Visitor(ip, os, browser);
		visitor.setUserAgent(userAgent);
		visitor.setComment(comment);
		return this.visitorDAO.insert(visitor);
	}*/
	

	@Override
	public boolean save(Visitor entity) {
		return this.visitorDAO.saveOrUpdate(entity);
	}
	
	@Override
	public boolean delete(String id) {
		return this.visitorDAO.delete(id);
	}
	
	@Override
	public List<Visitor> findAll() {
		return this.visitorDAO.findAll();
	}

	@Override
	public Visitor findById(String id) {
		return this.visitorDAO.findById(id);
	}

	@Override
	public List<Visitor> findByPage(int min, int max) {
		return this.visitorDAO.findByPage(min, max);
	}

}